package com.springtest;

import java.time.LocalDate;

/**
 * project : my-learn
 * <p>  </p>
 *
 * @author yisl
 * @date 2022-07-28【星期四】
 **/

    public class TestAdd {
         Integer i=0;

        public void addI(){
            i++;
        }

        public static void main(String[] args) throws InterruptedException {
            final  TestAdd test01 = new TestAdd();
            for (int n = 0; n < 10; n++) {
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            Thread.sleep(10);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                        test01.addI();
                    }
                }).start();
            }
            Thread.sleep(10000);//等待10秒，保证上面程序执行完成
            System.out.println(test01.i);

            //LocalDate date = LocalDate.now();
            //System.out.println(date);
            //System.out.println(date.getYear());
            //LocalDate date1 = LocalDate.of(2022, 8, 2);
            //System.out.println(date1);
            //if(date.equals(date1)){
            //    System.out.println("时间相等");
            //}else{
            //    System.out.println("时间不相等");
            //}
        }
    }


